//
//  Kylin_WebViewController.m
//  03-BuDeJie-2 TabBar设置
//
//  Created by Kylin on 16/2/17.
//  Copyright © 2016年 kylin. All rights reserved.
//

#import "Kylin_WebViewController.h"
#import "Kylin_MeSpuares.h"
@interface Kylin_WebViewController()<UIWebViewDelegate>
@property (weak, nonatomic) IBOutlet UIWebView *webView;
@property (weak, nonatomic) IBOutlet UIBarButtonItem *backItem;
@property (weak, nonatomic) IBOutlet UIBarButtonItem *forwardItem;

@end
@implementation Kylin_WebViewController

- (void)viewDidLoad{
    [super viewDidLoad];
    
    self.title = self.square.name;
    
    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:self.square.url]]];
    
    self.webView.backgroundColor = Kylin_CommonBgColor;
//    self.webView.scrollView.contentInset = UIEdgeInsetsMake(64, 0, 0, 0);
    
}
- (IBAction)back:(id)sender {
    [self.webView goBack];
}
- (IBAction)forward:(id)sender {
    [self.webView goForward];
}
- (IBAction)refresh:(id)sender {
    [self.webView reload];
}

#pragma mark- delegate
- (void)webViewDidFinishLoad:(UIWebView *)webView{
    
    self.backItem.enabled = webView.canGoBack;
    self.forwardItem.enabled = webView.canGoForward;
}
@end
